﻿//10.Write a program that finds in given array of integers a sequence of given sum S (if present).
//Example:  {4, 3, 1, 4, 2, 5, 8}, S=11 {4, 2, 5}.


using System;

class SequenceOfGivenSum
{
    static void Main()
    {
        int numberN = int.Parse(Console.ReadLine());
        int sumS = int.Parse(Console.ReadLine());
        int[] arrayN = new int[numberN];
        for (int i = 0; i < arrayN.Length; i++)
        {
            arrayN[i] = int.Parse(Console.ReadLine());
        }

        int indexArrayI = 0;
        int indexArrayJ = 0;
        for (int i = 0; i < arrayN.Length - 1; i++)
        {
            int sum = arrayN[i];
            for (int j = i + 1; j < arrayN.Length; j++)
            {
                sum = sum + arrayN[j];
                if (sum == sumS)
                {
                    indexArrayI = i;
                    indexArrayJ = j;
                    for (int k = indexArrayI; k <= indexArrayJ; k++)
                    {
                        Console.WriteLine(arrayN[k]);
                    }
                    Console.WriteLine();
                }
            }
        }
    }
}
